<%@ page language="java" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>广东省传播平台-物料详情展开页</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/common.css" />
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/tag.css" />
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.7.2.js"></script>
<link href="<%=request.getContextPath()%>/js/My97DatePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	function doSubmit(url) {
		document.forms[0].action = url;
		document.forms[0].submit();
	}
	
	
	function backup() {
		window.history.go(-1);
		window.location.reload();
	}

	function deleteMaterial(matId) {
		if (confirm('确定删除该条记录？')) {
			$.ajax({
				url : 'delMaterialAction.action?matId=' + matId,
				type : "POST",
				cache : false,
				success : function(message) {
					if (message == "success") {
						alert("物料删除成功！");
						doSubmit('materiallist.action');
					} else if(message=="beUsed"){
						alert("物料已被使用，不能删除 ！ ");
						//doSubmit('materiallist.action');
					}else if(message=="isDeleted"){
						alert("物料信息不存在！ ");
						doSubmit('materiallist.action');
					}else if(message=="error"){
						window.location.href="goError.action";

					}
				}
			});
		}
	}

	//下载文件
	function downloadFile(fileName) {
		var url = encodeURI(encodeURI("downLoadMaterialFileName.action?fileName="
				+ fileName));
		window.location.href = url;
	}
</script>
</head>

<body>
<!-- 顶栏start -->
<jsp:include page="../common/top.jsp"></jsp:include>
<!-- 顶栏end -->


<!-- 顶部start -->
<div id="main">
	<div class="body">
		<!-- 导航菜单 -->
		<jsp:include page="../common/nav.jsp"></jsp:include>
		<!-- 主体 -->
		<div class="main_body">
		  <form action="" method="post">
			<table class="condition" style="width:100%; font-size:14px; font-weight:bold; color:#000000;" align="center">
				<tr>
					<td>
			        <s:if test="%{null!= materialDetail}">
						<s:if test="#session.logUser.usercity == materialDetail.ownCity">
							<input type="button" class="btn-title" value="新增" onclick="doSubmit('toAddMaterialAction.action');" />
							&nbsp;&nbsp;&nbsp;
							<input type="button" class="btn-title" value="编辑" onclick="doSubmit('toEditMaterialAction.action?matId=${materialDetail.matId}');" />
							&nbsp;&nbsp;&nbsp;
							<input type="button" class="btn-title" value="删除" onclick="javascript:deleteMaterial('${materialDetail.matId}');" />
							&nbsp;&nbsp;&nbsp;
						</s:if>
						<input type="button" class="btn-title" value="返回" onclick=" javascript:history.go(-1); " />
					</s:if>
					<s:else>
					<input type="button" class="btn-title" value="返回" onclick="javascript:window.location.href='materiallist.action';" />
					</s:else>
					</td>
				</tr>
				
			</table>
			
			<div id="list_div">
				<table class="table_list" style="width:100%;">
				<s:if test="%{null== materialDetail}">
				<tr>
					<th style="width: 150px; text-align: center;color: red;" colspan="3">
							该条记录不存在或已删除！ 									
					</th>
				</tr>
				</s:if>
				<s:else>
				<s:iterator value="materialDetail" id="materialDetail">
					<tr class="bg" style="text-align:left;background:#f2f2f2;border-left: 2px solid #f37c20;">
						<th colspan="13" style="font-size:15px; padding-left:18px;">物料信息</th>
					</tr>
					<tr style="background:#f2f2f2;">
						<th style="border-style:solid dashed dashed solid;">物料编号</th>
						<th style="border-style:solid dashed dashed;">物料名称</th>
						<th style="border-style:solid dashed dashed;">物料类型</th>
						<th style="border-style:solid dashed dashed;">物料级别</th>
						<th style="border-style:solid dashed dashed;">归属城市</th>
						<th style="border-style:solid dashed dashed;">业务类型</th>
						<th style="border-style:solid dashed dashed;">最初上线时间</th>
						<th style="border-style:solid dashed dashed;">部门科室</th>
						<th style="border-style:solid solid dashed dashed;">物料排序</th>
					</tr>
					
					
					
					<tr>
						<td style="border-style:dashed dashed solid solid;" title="${materialDetail.materialID}">
						${fn:substring(materialDetail.materialID, 0, 20) }
						</td>
						
						<td style="border-style:dashed dashed solid;" title="${materialDetail.materialName}">
							${fn:substring(materialDetail.materialName, 0, 12) }
						</td>
						
						<td style="border-style:dashed dashed solid;">
						 <s:iterator value="dataListWLLX" id="cl">
							            <s:if test="#cl.id == #materialDetail.materialType">
								            ${cl.datavalue}
							            </s:if>
						                </s:iterator>
						</td>
						
						<td style="border-style:dashed dashed solid;">
						 <s:iterator value="dataListWLJB" id="cl">
							            <s:if test="#cl.id == #materialDetail.materialLevel">
								            ${cl.datavalue}
							            </s:if>
						                </s:iterator>
						</td>
						
						<td style="border-style:dashed dashed solid;">
						<s:iterator value="dataListCITY" id="cl">
							            <s:if test="#cl.id == #materialDetail.ownCity">
								            ${cl.datavalue}
							            </s:if>
						                </s:iterator>
						</td>
						<td style="border-style:dashed dashed solid;">
						<s:iterator value="dataListWLYWLX" id="cl">
							            <s:if test="#cl.id == #materialDetail.serviceType">
								            ${cl.datavalue}
							            </s:if>
						                </s:iterator>
						</td>
						<td style="border-style:dashed dashed solid;">${materialDetail.firstUpTime}</td>
						<td style="border-style:dashed dashed solid;">${materialDetail.ownDepartment}</td>
						<td style="border-style:dashed solid solid dashed;">${materialDetail.orderCol}</td>
						
					</tr>
					<tr style="text-align:left;background:#f2f2f2;">
						<th colspan="13" style="padding-left:18px; border-style:solid solid dashed;">物料描述</th>
					</tr>
					<tr >
						<td colspan="13" style="text-align:left;border-style:dashed solid solid;" title="${materialDetail.accessory}">
						&nbsp;&nbsp;&nbsp;&nbsp;${fn:substring(materialDetail.accessory, 0, 80) }
						</td>
					</tr>
					
					<tr class="bg" style="left;background:#f2f2f2;border-left: 2px solid #f37c20;">
						<th colspan="13" style="font-size:15px; padding-left:18px;">物料文件</th>
					</tr>
					
			
					<tr style="text-align:left;" id="detailId">
						<td colspan="13" id="tdID">
						<s:if test="%{null != materialDetail.materialContent && materialDetail.materialContent !=''}">
							&nbsp;&nbsp;&nbsp;&nbsp;
							<img src="<%=request.getContextPath()%>/images/hetong.jpg" width="20" height="20" align="middle" />
							${materialDetail.materialContent}
							&nbsp;&nbsp;
							<a href="javascript:downloadFile('${materialDetail.materialContent}');" title="下载"><img src="<%=request.getContextPath()%>/images/download.gif" align="middle" alt="下载" /></a>
						</s:if>
						<s:else>
							&nbsp;&nbsp;&nbsp;&nbsp;暂无物料文件
						</s:else>
						</td>
						
					</tr>
				
					<tr class="bg" style="left;background:#f2f2f2;border-left: 2px solid #f37c20;">
						<th colspan="13" style="font-size:15px; padding-left:18px;">变更记录</th>
					</tr>
					<tr style="text-align:left;">
						<td colspan="13">
							<ul>	
							<s:iterator value="logList" id="list">
								<li style="height:30px; line-height:30px;">&nbsp;&nbsp;&nbsp;&nbsp;${list.content}。</li>
							</s:iterator>
							</ul>
						</td>
					</tr>
					</s:iterator>
					</s:else>
				  </table>
				</div>
		</form>
			</div>
		</div>
	</div>

<!-- 顶部end -->


<!-- 底部start -->
<jsp:include page="/jsp/common/bottom.jsp"></jsp:include>
<!-- 底部end -->
</body>
</html>
